import java.lang.Object;
import java.util.Currency;
import java.util.*;

public abstract class Money
{
	private long amount;
	private Currency currency;
	public Money(long amount, Currency currency)
	{
		this.amount = amount;
		this.currency = currency;
	}
	public long getAmount() { return amount; }
	public Currency getCurrency() { return currency; }
	public String toString()
	{
		String sign = (amount < 0 ? "-" : " ");
		Long absAmount = (amount < 0 ? -amount : amount);
		String code = currency.getCurrencyCode();
		int fractDigits = currency.getDefaultFractionDigits();
		int unit = tenToPower(fractDigits);
		if(fractDigits > 0)
		{
			return sign + absAmount/unit + "." + fill(fractDigits, absAmount % unit) + code;
		}
		else
		{
			return sign + absAmount + code;
		}
	}
	public abstract int CompareTo(Money o);
	public abstract boolean equals(Object o);
	public abstract int hashCode();
	public abstract Money plus(Money m);
	public abstract Money minus(Money m);
	public abstract Money times(double factor);
	public abstract Money dividedBy(double divisor);
	public abstract Money negate();
}

